package test;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {

        ServerSocket serverSocket=new ServerSocket(10086);
        //需要接收client从传输过来的数据，需要socket对象
        Socket socket=serverSocket.accept();
        InputStream inputStream = socket.getInputStream();
        DataInputStream dataInputStream=new DataInputStream(inputStream);
        byte[] a=new byte[1024];
       int length=dataInputStream.read(a);
        System.out.println(new String(a,0,length));

//        String s = dataInputStream.readUTF();
//        System.out.println(s);

        dataInputStream.close();
        inputStream.close();
        socket.close();
        serverSocket.close();

    }
}
